Loading TOC...

POST /v1/transactions/{txid}

Summary

Commit or rollback the transaction whose id matches the txid given in the request URI.

URL Parameters
result Specifies the desired outcome of the transaction. Allowed values: commit, rollback.
database? Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.

Response

MarkLogic Server responds with status 204 (Committed or Rolled Back). If the transaction does not exist, MarkLogic Server responds with status 400 (Bad Request).

Required Privileges

This operation requires the rest-writer role, or the following privileges:

http://marklogic.com/xdmp/privileges/rest-writer

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

The txid component of the request URI is transaction id, as is returned by creating a transaction with a POST request on the /transactions service.

This method marks a transaction for commit, but commit does not occur until any currently executing statements in the transaction complete. For more details, see xdmp:commit.

For more details, see Committing or Rolling Back a Transaction in the REST Application Developer's Guide.

Example

$ curl --anyauth --user user:password -X POST -d "" -i \
  -H "Content-type: text/plain" \
  http://localhost:8000/v1/transactions/12782288875903241087?result=commit

==> The requested transaction is committed. MarkLogic Server returns
    the following headers:

Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close

HTTP/1.1 100 Continue

HTTP/1.1 204 Committed
Server: MarkLogic
Content-Length: 0
Connection: close
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.